/*
 * =====================================================================================
 *
 *       Filename:  cl_socket_addr.hxx
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  03/24/2011 05:08:09 AM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Chen Ken (Ken), zlchen.ken@gmail.com
 *        Company:  EMC
 *
 * =====================================================================================
 */

#ifndef _CL_SOCKET_ADDR_HXX_
#define _CL_SOCKET_ADDR_HXX_

#include <sys/socket.h>
#include <memory>
#include <string>

namespace neo
{

class CLSocketAddr
{
public:
	virtual ~CLSocketAddr();
	CLSocketAddr* clone(void) const;
	int family(void) const;
	int size(void) const;
  const struct sockaddr* address(void) const; 
	const std::string toString(void) const;
	bool isValid(void) const;

private:
	virtual CLSocketAddr* doClone(void) const = 0;
  virtual int getFamily(void) const = 0;
	virtual size_t getSize(void) const = 0;
	virtual const struct sockaddr* getAddress(void) const = 0;
	virtual bool doIsValid(void) const = 0;
	virtual const std::string doToString(void) const = 0;
};

typedef std::shared_ptr<CLSocketAddr> CLSocketAddrSPtr;
typedef std::unique_ptr<CLSocketAddr> CLSocketAddrUPtr;

} // neo

#endif //_CL_SOCKET_ADDR_HXX_

